<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>云平台日志管理</title>
		<link rel="stylesheet" type="text/css" href="../layui/css/layui.css"/>
		<style type="text/css">
		.log-con{
			padding: 0 15px 15px 15px;
		}
		.log-con .layui-table-body table tbody .layui-table-hover{
			background: #fffdd3 !important;
		}
		.log-con .layui-table-body table tbody .layui-table-click{
			background: #fdef9b !important;
		}
		.log-con .layui-table,.layui-table-view{
			border: none;
			margin-top: 0px;
		}
		.log-con .layui-table-tool{
			margin-bottom: 10px;
		}
		.layui-form-select dl dd.layui-this{
			background-color:#1E9FFF!important;
		}
		.not_border_left {
			border-left: none !important;
		}
		</style>
	</head>
	<body>
	<div class="log-con">
		<!-- 条件查询区Start -->
		<blockquote class="layui-elem-quote not_border_left">
		<form class="layui-form" action="">	
			<div class="layui-inline"> 
				<div class="layui-input-inline">
				    <select name="selschooltype" id="selschooltype" lay-filter="selschooltype" lay-event="selschooltype">
					    <option value="00">请选择学校类型</option>
					</select>	
				</div>
				<div class="layui-input-inline">
				    <select name="selschool" id="selschool" lay-filter="selschool" lay-event="selschool">
					     <option value="00">请选择所属学校</option>
					 </select>
				</div>	
				<div class="layui-input-inline">
					<select id="sellogtype" lay-verify="required">
       					<option value="00">请选择操作类型</option>
       					<option value="add">添加</option>
       					<option value="update">修改</option>
       					<option value="delete">删除</option>
     				</select>
			   </div>
				<div class="layui-input-inline">
					<input id="username" type="text" autocomplete="off" lay-verify="username" placeholder="请输入操作人真实姓名" class="layui-input">
			   </div>
			    <div class="layui-inline">
      				<button class="layui-btn layui-bg-blue" id="seleBtn" type="button">查询</button>
			    </div>
			</div>
		</form>
		</blockquote>
		<!-- 条件查询区End-->
	
		<!--文章表格列表-->
		<table class="layui-hide log-tab" id="sellog" lay-filter="sellog" ></table>
	</div>
	
	<script src="../js/jquery-3.3.1.js"></script>
	<script src="../layui/layui.js"></script>
	<script type="text/javascript">
	layui.use(['table','form'], function() {
		var table = layui.table,form = layui.form;
		
		/*加载学校类型下拉框*/
		$.ajax({
			type : 'get',
			url : '../json/schoolType.json',
			datatype : 'json',
			success : function(schooltypedate) {
				if (schooltypedate.code == 0) {
					var str = "";
					for(var i = 0; i < schooltypedate.count; i++){
						str += '<option value=' + schooltypedate.data[i].id + '>'+ schooltypedate.data[i].name+'</option>';
					}
					$("#selschooltype").append(str);
					form.render("select");
				}
			 }
		});
		
		/*点击学校类型下拉框*/
		form.on('select(selschooltype)', function(data) {
			var schooltype = data.value;
			if(schooltype=="00" || schooltype==null || schooltype==""){
				schooltype="";
			}
			$("#selschool").html("");
			$.ajax({
				type : 'get',
				url : '../sysschoolmanagement/getschoolbywhere?schooltype='+schooltype,
				datatype : 'json',
				success : function(schooldata) {
					if (schooldata.code == 0) {
						var str = "<option value='00'>请选择学校</option>";
						for(var i = 0; i < schooldata.count; i++){
							str += '<option value=' + schooldata.data[i].schoolid + '>'+ schooldata.data[i].schoolName +'</option>';
						}
						$("#selschool").append(str);
						form.render("select");
					}
					else{
						layer.msg('暂无对应的学校！', function(){});
						form.render("select");
					}
				}
			});
		});
		
		table.render({
			elem: '#sellog',
			url: '../cloudlogmanagement/getcloudloglist',
			title: '错误日志表',
			height:'full-105',
			skin: 'line',
			even: true,
			cols: [
				[{
					field: 'userName',
					title: '用户名',	
					unresize: true
				},{
					field: 'realName',
					title: '真实姓名'
				}, {
					field: 'roleName',
					title: '角色类型'
				}, {
					field: 'phone',
					title: '联系电话'
				}, {
					field: 'operationType',
					title: '操作类型'
				}, {
					field: 'schoolName',
					title: '所属学校'
				}, {
					field: 'menuName',
					title: '菜单名称'					
				},{
					field: 'operationDescribe',
					title: '操作描述'						
				},{
					field: 'operationTime',
					title: '操作时间'							
				}]
			],
			page: {
				layout: ['prev', 'page', 'next', 'skip', 'count', 'limit'],
				groups: 5,
				limit: 10,
				limits: [10, 20, 30, 40, 50],
				theme: '#1E9FFF',						
			}
		});

		//顶部查询输入框
		$("#seleBtn").click(function(){
			var username = $("#username").val();
			var sellogtype=$("#sellogtype").val();
			var schoolid = $("#selschool").val();
			if(sellogtype == "00" || sellogtype == undefined || sellogtype == null){
				sellogtype="";
			}
			if(schoolid == "00" || schoolid == undefined || schoolid == null){
				schoolid = "";
			}
			table.render({
				elem: '#sellog',
				url: '../cloudlogmanagement/getcloudloglist?realname='+username+'&operationtype='+sellogtype+'&schoolid='+schoolid,
				title: '错误日志表',
				height:'full-90',
				skin: 'line',
				even: true,
				cols: [
					[{
						field: 'userName',
						title: '用户名',	
						unresize: true
					}, {
						field: 'realName',
						title: '真实姓名'
					}, {
						field: 'roleName',
						title: '角色类型'
					}, {
						field: 'phone',
						title: '联系电话'
					}, {
						field: 'operationType',
						title: '操作类型'
					},{
						field: 'schoolName',
						title: '所属学校'
					}, {
						field: 'menuName',
						title: '菜单名称'					
					},{
						field: 'operationDescribe',
						title: '操作描述'						
					},{
						field: 'operationTime',
						title: '操作时间'							
					}]
				],
				page: {
					layout: ['prev', 'page', 'next', 'skip', 'count', 'limit'],
					groups: 5,
					limit: 10,
					limits: [10, 20, 30, 40, 50],
					theme: '#1E9FFF',						
				}
			});
		});
	});
	</script>
	</body>
</html>
